<template>
    <div class="table">
        <div class="crumbs">
            <el-breadcrumb separator="*">
                <el-breadcrumb-item><i class="el-icon-menu"></i>分数总汇</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
       
        <div class="handle-box">
          
            <el-select v-model="departmentCode" clearable placeholder="部门" class="handle-select mr10">
                <el-option
                    v-for="item in categoryList"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code">
                </el-option>
            </el-select>
            <el-select v-model="scoreType" clearable placeholder="人员类别" class="handle-select mr10">
                <el-option
                    v-for="item in scoreTypeList"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code">
                </el-option>
            </el-select>
            <el-button type="primary" icon="search" @click="search">搜索</el-button>
        </div>
        <el-table :data="data" border style="width: 100%" ref="multipleTable" @selection-change="handleSelectionChange">
           <!-- <el-table-column type="selection" width="55"></el-table-column>-->
           <el-table-column  prop="name" label="名字"  >
            </el-table-column>
            <el-table-column  prop="code" label="绩效分" >
            </el-table-column>
            <el-table-column prop="score" label="额外分" >
            </el-table-column>
            <el-table-column prop="sumScore" label="总分" >
                <!-- <template slot-scope="scope">
                    <el-button size="small"
                            @click="isShow = true,handleEdit(scope.$index, scope.row)">编辑</el-button>
                             <el-button size="small" type="danger"
                            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                    
                </template> -->
            </el-table-column>
        </el-table>
        <div class="pagination">
            <el-pagination
                    @current-change ="handleCurrentChange"
                    @size-change="handleSizeChange"
                    layout="sizes,prev, pager, next, total"
                    :page-sizes="[10,20,50]"
                    :page-size="pageSize"
                    :total="total">
            </el-pagination>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                url: './static/vuetable.json',
                tableData: [],
                curPage: 1,
                pageSize: 10,
                total:0,
                title:'',
                multipleSelection: [],
                code: '',
                del_list: [],
                departmentCode:'',
                scoreType:'',
                departmentList:'',
                dialogFormVisible: false,
                categoryList:[
                 {name:'HSBC',code:'0101'},
                 {name:'AIA',code:'0102'},
                ],
                scoreTypeList:[
                 {name:'组长',code:'TL'},
                 {name:'组员',code:'TM'}
                ],
                is_search: false
            }
        },
        created(){
            this.getData();
        },
        computed: {
            data(){
                const self = this;
                return self.tableData.filter(function(d){
                    
                    let is_del = false;
                    for (let i = 0; i < self.del_list.length; i++) {
                   
                        if(d.name === self.del_list[i].name){
                            is_del = true;
                            break;
                        }
                    }
                    return d;
                })
            },
            totalRecord(){
                return this;
            }
        },
        methods: {
            handleCurrentChange(val){
                this.curPage = val;
                this.getData();
            },
             handleSizeChange (val) {
                 this.pageSize = val;
                 this.getData();
           
           } ,
            /*getData(){
                let self = this;
                if(process.env.NODE_ENV === 'development'){
                    self.url = '/ms/table/list';
                };
               var searchCriteria = {};
               searchCriteria.code = self.code;
               searchCriteria.scoreType = self.scoreType;
               searchCriteria.category = self.category;    

                self.$axios.post("../adm/additionalScore/page?size="+self.pageSize+"&page="+(self.curPage-1), searchCriteria).then((res) => {
                    self.tableData = res.data;
                    self.total = res.total;
                });
            },
*/            
            getData(){
                let self = this; 
                self.$axios.get("../wx/rank/admin?staffId=admin&scoreType=1").then((res) => {
                    self.tableData = res.data;
                    self.total = res.total;
                });
            },
            search(){
                let self = this;
                var searchCriteria = {};
                searchCriteria.code = self.code;  
                searchCriteria.scoreType = self.scoreType;  
                searchCriteria.category = self.category;       
                /*self.$axios.post("../adm/additionalScore/page?size="+self.pageSize+"&page="+(self.curPage-1), searchCriteria).then((res) => {*/
                    self.$axios.get("../wx/rank/admin?staffId=admin&scoreType=1").then((res) => {
                    self.tableData = res.data;
                    self.total = res.total;
                });
            }
        }
    }
</script>

<style scoped>
.handle-box{
    margin-bottom: 20px;
}
.handle-select{
    width: 180px;
}
.handle-input{
    width: 180px;
    display: inline-block;
}
.input{
    width: 60px;
    display: inline-block;
}
.input1{
    width: 120px;
    display: inline-block;
}
.input2{
    width: 120px;
    display: inline-block;
    height: 100px;
}
</style>
